package com.chinasoft.service;

import com.chinasoft.dao.RoleDao;
import com.chinasoft.pojo.Role;
import com.chinasoft.tools.DBUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Connection;
import java.util.List;
@Service
public class RoleServiceImpl implements RoleService{
    @Autowired
    RoleDao roleDao;

    @Override
    public List<Role> getRoleList() {
        Connection connection = null;
        List<Role> roleList = null;
        try{
            connection = DBUtil.getConnection();
            roleList = roleDao.getRoleList(connection);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            DBUtil.closeResource(connection,null,null);
        }
        return roleList;
    }
}
